package zb.blog.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import zb.blog.base.util.StringUtil;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/test")
public class TestController {
    private List<String> list1 = new ArrayList<>();
    private static List<String> list2 = new ArrayList<>();

    @RequestMapping("/getIp")
    public void getIpTest(HttpServletRequest request) {
        String ip = StringUtil.getIpAddr(request);
        list1.add(ip);
        list2.add(ip);
        System.out.println("list1:" + list1);
        System.out.println("list2:" + list2);

    }

}
